home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
EARCD
/
comm
/
thor
/
thor24arexx.lha
/
AddMIME.thor
next >
Wrap
Text File
|
1996-11-11
|
3KB
|
130 lines
/*
$VER: AddMIME.thor 0.3 (3.10.96)
by Remco van Hooff
Attach a file (MIME) while writing a msg in Thor.
Run from FSE, CED or GED.
Borrowed some code from InsertIt.thor.
HISTORY
0.2 - When the filerequester would be cancelled an empty attacment would be
created.
- No more requester/status bar stating DOC=xxx when using GoldED.
0.3 - When the uploadpath for the current system is not defined the global
upload path is used.
*/
OPTIONS RESULTS
/*!~ "Get MSGFILE from editor" */
editor.name.1 = 'GOLDED'
editor.filename.1 = 'QUERY DOC VAR filename'
editor.name.2 = 'THOR_FSE'
editor.filename.2 = 'MSGFILENAME'
editor.name.3 = 'rexx_ced'
editor.filename.3 = 'status 21'
editor.count = 3
DO n = 1 TO editor.count
IF(SUBSTR(ADDRESS(),1,LENGTH(editor.name.n)) = editor.name.n) THEN DO
editorport = address()
INTERPRET editor.filename.n
filename = RESULT
IF POS('/', filename) ~= 0 THEN filename = SUBSTR(filename, (LASTPOS('/', filename) + 1))
END
END
IF editorport = '' THEN DO
SAY 'This script has to be run from your editor.'
SAY 'GoldED, FSE (Thor''s internal editor) and CygnusED are currently supported.'
EXIT
END
/*~!*/
/*!~ "Init" */
p=' '||ADDRESS()||' '||SHOW('P',,)
IF POS(' THOR.',p)>0 THEN thorport=WORD(SUBSTR(p,POS(' THOR.',p)+1),1)
ELSE DO
SAY 'THOR port not found!'
EXIT 10
END
IF ~SHOW('p', 'BBSREAD') THEN DO
ADDRESS COMMAND
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
END
/*~!*/
/*!~ "Get system stuff" */
ADDRESS(thorport)
'CURRENTBBS stem CURRENT'
IF(RC ~= 0 | CURRENT.BBSNAME ~= "") THEN system = CURRENT.BBSNAME
ELSE EXIT
ADDRESS(bbsread)
'GETBBSDATA "'system'" STEM BBSDATA'
IF(RC ~= 0) THEN DO
ADDRESS(thorport)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_Ok"'
EXIT 5
END
updir = BBSDATA.UPLOADPATH
IF updir = '' THEN DO
'GETGLOBALDATA STEM GLOBAL'
IF(RC ~= 0) THEN DO
ADDRESS(thorport)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_Ok"'
EXIT 5
END
updir = GLOBAL.UPLOADPATH
END
/*~!*/
/*!~ "Attach file" */
DO i = BBSDATA.FIRSTEVENT TO BBSDATA.LASTEVENT
DROP MSGTAGS. MSGDATA.
'READBREVENT BBSNAME "'system'" EVENTNR 'i' TAGSSTEM MSGTAGS DATASTEM MSGDATA'
IF(RC ~= 0) THEN DO
ADDRESS(thorport)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_Ok"'
EXIT 5
END
IF(filename = MSGTAGS.MSGFILE) THEN DO
attachfile = request_file(updir)
IF (EXISTS(attachfile) & attachfile ~= '') THEN DO
MSGTAGS.LOCALFILE = attachfile
WRITEBREVENT BBSNAME '"'system'"' EVENT MSGDATA.EVENTTYPE STEM MSGTAGS UPDATEEVENTNR i
IF(RC ~= 0) THEN DO
ADDRESS(thorport)
'REQUESTNOTIFY TEXT "'BBSREAD.LASTERROR'" BT "_Ok"'
EXIT 5
END
EXIT
END
END
END
/*~!*/
EXIT
/*!~ "Request_File" */
request_file:
path = ARG(1)
ADDRESS(thorport)
'REQUESTFILE TITLE "Select file to attach." ID "'path'" FP'
IF (RC = 30) THEN DO
ADDRESS(thorport)
'REQUESTNOTIFY TEXT "'THOR.LASTERROR'" BT "_Ok"'
EXIT
END
IF RC = 5 THEN RETURN('')
IF RC = 0 THEN dir = RESULT
RETURN(dir)
/*~!*/